package com.complaint.rest.model;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by Alex
 */
@Entity(name = "Complaint")
@XmlRootElement(name = "complaint")
@XmlAccessorType(XmlAccessType.FIELD)
public class Complaint implements Serializable {
    @Id
    @XmlElement(name = "id")
    private String id;
    @XmlElement(name = "authorId")
    private String authorId;
    @XmlElement(name = "subject")
    private String subject;
    @XmlElement(name = "description")
    private String description;
    @XmlElement(name = "publishDate")
    @XmlJavaTypeAdapter(DateAdapter.class)
    private Date publishDate;

    public Complaint() {
    }

    public Complaint(String id, String authorId, String subject, String description, Date publishDate) {
        this.id = id;
        this.authorId = authorId;
        this.subject = subject;
        this.description = description;
        this.publishDate = publishDate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAuthorId() {
        return authorId;
    }

    public void setAuthorId(String authorId) {
        this.authorId = authorId;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }
}
